<template>

</template>

<script>
  import { getToken } from '@/utils/auth'
  import { queryFile, updateFile, deleteFile } from '@/api/basic/file.js'

  export default {
    name: "toolsDownload",
    components: {},
    data() {
      return {
        loading: false,
        leftFiles: [],
        rightFiles: [],
      };
    },
    created() {
      this.getLeftFileList();
      this.getRightFileList();
    },
    activated() {
    },
    methods: {
      getLeftFileList(){
        queryFile({
          fileType: "业务模板",
          pageNum: 1,
          pageSize: 100
        }).then(response => {
          this.leftFiles = response.rows;
        });
      },
      getRightFileList(){
        queryFile({
          fileType: "系统工具",
          pageNum: 1,
          pageSize: 100
        }).then(response => {
          this.leftFiles = response.rows;
        });
      },
      downloadFile(item){
        let url = process.env.VUE_APP_BASE_API + "/common/download/resource?filePath=" + encodeURI(item.filePath) + "&downloadName="+encodeURI(item.fileName)+"&delete=" + false;
        window.open(url);
      },
      enableReview(item){
        let ext = item.fileName.substring(item.fileName.lastIndexOf(".") + 1, item.fileName.length);
        return (ext == "gif" || ext== "jpeg" || ext== "jpg" || ext == "png");
      },
      previewFile(item) {
        this.dialogImageUrl = process.env.VUE_APP_BASE_API + item.filePath;
        this.dialogVisible = true;
      },
    },
  };
</script>
<style scoped lang="less">
</style>
